package com.healthbox.notifications.controller;


import com.healthbox.notifications.commom.Result;
import com.healthbox.notifications.entity.AddressRisk;
import com.healthbox.notifications.entity.HealthState;
import com.healthbox.notifications.service.AddressRiskService;
import com.healthbox.notifications.service.HealthStateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chs
 * @since 2022-05-12
 */
@RestController
@Api(tags = "地区风险系统")
@RequestMapping("/addressrisk")
public class AddressRiskController {

    @Autowired
    AddressRiskService addressRiskService;

    @ApiOperation(value = "变更地区风险等级",notes = "机构管理员可更改地区的风险等级")
    @ApiResponses({ @ApiResponse(code = 200, message = "操作成功",response = AddressRisk.class ) })
    @PostMapping("/update")
    public Result updateAddressRisk(@RequestBody AddressRisk addressRisk,
                                    @RequestHeader("user-role") String role
                                    ){

        return addressRiskService.updateAddressRisk(addressRisk,role);
    }

    @ApiOperation(value = "查看中高风险地区",notes = "所有人可查看所有中高风险地区")
    @GetMapping("/getlist")
    public Result getAdressRiskList(){

        return addressRiskService.getAdressRiskList();
    }

}
